﻿<?php TPL::output('admin/admin_header.tpl.htm'); ?>

<body >
<div class="clear"></div>
<div id="body-wrapper">
	<div id="main-content">
		<div class="clear"></div>
		<div class="content-box">
			<div class="content-box-header">
				<h3><?php echo $this->crumb['last']['name']; ?></h3>
				<ul class="content-box-tabs">
				</ul>
				<div class="clear"></div>
			</div>

<div style="width:950px;">			
			<div class="content-box-content" style="width:500px;float:left;">

<?php if($this->category_position){ ?>
<p>
<label>
<b>分类导航：</b></label>
<?php foreach($this->category_position as $key => $val){ ?>
<a href="admin/category/list/parent_id-<?php echo $val['id'];?>"><?php echo $val['title']; ?></a> >
<?php } ?>
</label></p>
<?php } ?>

					<?php if(!$this->list){ ?>
					<div class="notification attention png_bg"> <a href="#" class="close"><img src="<?php echo G_STATIC_URL;?>/admin/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
						<div>没有分类</div>
					</div>
					<?php }else{ ?>
					
<form id="category_form" action="admin/category/sort_ajax/" method="post">
					<table>
						<thead>
							<tr>
								<th style="width:34px;">排序</th>
								<th>分类标题</th>
								<th>图标</th>
								<th>子分类</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
<?php foreach ($this->list AS $key => $val) { ?>
							<tr>
								
								<td  style="width:104px;"><input type="text" value="<?php echo $val['sort']; ?>" class="text-input medium-input" maxlength="3" style="width:60px;" name="category[<?php echo $val['id']; ?>][sort]"></td>
								<td><a href="admin/category/edit/category_id-<?php echo $val['id']; ?>"><?php echo $val['title']; ?></a></td>
								<td><?php if($val['icon']){ ?><img style="width:20px; height:20px;" src="<?php echo get_setting('upload_url'); ?>/category/<?php echo $val['icon']."?rd=".rand(100000,999999); ?>" /><?php } ?></td>
								<td><?php if($val['child_count'] > 0){ ?><a href="admin/category/list/parent_id-<?php echo $val['id']; ?>"><?php echo $val['child_count']; ?>个子分类</a><?php }else{ ?>无<?php } ?></td>
								<td>
									<a href="admin/category/edit/category_id-<?php echo $val['id']; ?>" title="修改分类"><img src="<?php echo G_STATIC_URL;?>/admin/images/icons/pencil.png"/></a>
									&nbsp;
									<a href="javascript:void(0);" onClick="category_remove(<?php echo $val['id'];?>)" name="remove" rel="<?php echo $val['topic_id']; ?>" title="删除话题"><img src="<?php echo G_STATIC_URL;?>/admin/images/icons/cross.png" alt="删除" /></a>
								</td>
							</tr>
<?php } ?>
						</tbody>
					</table>
<p style="margin-top:10px;">
<input type="button" value="更新排序" onclick="ajax_post($('#category_form'), _form_process);" class="button">
</p>
</form>
					<?php } ?>
				</div>

<div class="content-box-content" style="margin-left:10px; width:250px; float:left;">
<h3>添加分类</h3>
				<div class="tab-content default-tab" id="tab1">
					<form id="_save_form" action="admin/category/save_ajax/" method="post">
						<p>
							<label>分类标题：</label>
							<input type="text" value="" class="text-input medium-input" name="title">
						</p>
						<p>
							<label>分类描述：</label>
							<input id="description" type="text" value="" class="text-input medium-input" name="description">
						</p>
						<p>
							<label>父级分类：</label>
							<select name="parent_id" style="width:200px;">
								<option value="0">无</option>
								<?php echo $this->category_option; ?>
							</select>
						</p>
						<p>
							<label>分类图标：</label>
							<input name="category_icon" class="upload-input" type="file"><br /><small>(支持上传图片类型：jpg,jpeg,gif,png)</small>
						</p>
						<p>
							<input class="button" type="button" onClick="ajax_post($('#_save_form'), _form_process);" value="添加新分类" />
						</p>
							</label>
						</p>
					</form>

				</div>
		</div>

</div>

		</div>
		
		
	</div>
	
	<div class="clear"></div>
</div>

<?php TPL::output('admin/admin_footer.tpl.htm'); ?>